#ifndef CXGRABTHREAD_H
#define CXGRABTHREAD_H

#include <QThread>
#include <QMutex>
#include <QWaitCondition>


#include <cxcamerainfo.h>
#include <CxImageBuffer.hpp>


class CxGrabThread : public QThread
{
    Q_OBJECT
public:

    explicit CxGrabThread(dc1394camera_t * ,CxImageBuffer<4> *,QObject *parent = 0);

protected:

    void        run();
    
signals:
    
public slots:


    void            slot_start();
    void            slot_exit();

    void            slot_pause();
    void            slot_continue();

protected:

    void            grabStart();
    void            grabExit();


private:

    volatile    bool        m_outerSpin;
    volatile    bool        m_innerSpin;


    uint                    width,height;

    CxImageBuffer<4>        *m_pbuffer;
    dc1394camera_t          *m_pcamera;

    QMutex                  m_mu;
    QWaitCondition          m_pauseCond;
    
};

#endif // CXGRABTHREAD_H
